bin=aim.exe
src=$(wildcard *.c)
obj=$(src:.c=.o)
cc=gcc
rm=rm -f
$(bin):$(obj)
	@$(cc) $^ -o $@
	@echo "链接 $^ 成为 $@"
%.o:%.c
	@$(cc) -c $< -std=c99 -g
	@echo "编译 $< 成为 $@"
.PHONY:clean	
clean:
	@$(rm) $(obj) $(bin)
	
.PHONY:test
test:
	@echo $(bin)
	@echo $(src)
	@echo $(obj)









#$(bin):$(obj)
#	gcc $(obj) -o $(bin)
#$(obj):$(src)
#	gcc -c $(src) -o $(obj)
#
#.PHONY:clean
#clean:
#	$(rm) $(bin) $(obj)











#mytest:test.o
#	gcc test.o -o mytest
#test.o:test.s
#	gcc -c test.s -o test.o
#test.i:test.c
#	gcc -E test.c -o test.i
#test.s:test.i
#	gcc -S test.i -o test.s
#.PHONY:clean	
#clean:
#	rm -f *.i *.s *.o mytest







#mytest:test.c
#	gcc test.c -o mytest
#.PHONY:clean
#clean:
#	rm -f mytest
